var myView = {}
myView["getElement"] = function ( item) {
    let cssIcon = {
        "图片":"layui-icon-picture",
        "音频":"layui-icon-music",
        "视频":"layui-icon-video",
        "其他":"layui-icon-file-b",
    };

    
    let $md5 = md5(item["nas_abs_file_path"]);
    let p_html = _badge(item["nas_search_key"]);
    let file_name = item["nas_abs_file_path"].split("\\").slice(-1)[0];
    let len = $(".nas_check").length
    var elem= `<div id="${$md5}" class="item">
                <div class="box ${$md5}">
                    <div class="item-head">
                        <input type="checkbox" data-num="${len}" name="chk_${len}" data-item-id="#${$md5}" class="nas_check">
                        <label for="uesrname">
                        <a class="layui-icon ${cssIcon[item["nas_file_type"]]}">${len}</a>
                        </label>
                    </div>
                    <img  style="float:left" src="${getPath(item["nas_abs_file_raw_path"])}" />            
                    <div><div class="ellipsis-single-line">${file_name} </div>${p_html}</div>
                </div>
               </div>`;
    
    return elem;
    


};
function _badge(info) {

    if (info == null) {
        return "None";
    }
    tmps = info.split(" ");
    var html = "";
    tmps.forEach(function (item, index) {
        if (item.trim() != "") {
            html += `<span class="layui-badge" style="margin-right:2px;">${item}</span>`;
        }

    });
    return html;
}
function loading(msg ) {
    if(msg==null){
        msg = '加载中..'
    }
    layer.msg(msg, {
        icon: 16
        , shade: 0.3
        , time: false
    });
}
function cloading() {
    layer.closeAll();
}

function copyTextToClipboard(text) {
    navigator.clipboard.writeText(text).then(function() {
      layer.msg('文本成功复制到剪切板');
    }, function(err) {
        layer.msg('复制失败', err);
    });
  }